1. Field of the Invention
The present invention relates to a method for dynamic memory management.
2. Description of the Related Art
In connection with a real-time computer system it is known from U.S. Pat. No. 5,367,637, the entire contents of which are incorporated herein by reference, to employ two methods for memory allocation. In addition to the method present in the real-time computer system, an additional level between the application program and the real-time computer system is provided for achieving a self-optimizing and more efficient method for making memory space available. A rapid memory allocation is produced on the additional level by a memory pool, but without assuring that it is always possible to allocate memory space from the memory pool. A slower method is employed with the method already available in the computer system, wherein it is assured that it is always possible to allocate memory space. A pool made of memory blocks is installed on the additional level, from which a memory block can be taken when required. If there is no memory block in the pool, the already present method for memory allocation is used. In the course of this it is necessary to search all of the available memory space for a memory block which can be allocated and made available. During each initialization of the computer system, the number of memory blocks allocated to the pool is selected as a function of the number of requirements for memory blocks.
It is disadvantageous here that, as long as memory blocks are available in the pool, at least one memory block is taken out of the pool in case of a memory request. As soon as no more memory blocks are in the pool, the available physical memory space must be searched for a free memory block, which can take a relatively long time. This occurs regardless of whether memory is required for a program portion which must be executed in real time, or for a program portion which is not so time-critical.
A method for memory access is known from U.S. Pat. No. 5,930,141, the entire contents of which are incorporated herein by reference, which is said not to have any disadvantageous effect on the execution of a numerical control (NC) program. A first and a second memory are available, wherein the access time to the second memory is longer than to the first memory. The NC program is stored in the first memory. NC program blocks are divided into those, whose execution can wait, and those, whose execution cannot wait. As soon as access to the second memory is to take place during the execution of an NC program, a check is made whether the instruction of the next program block of the NC program next to be executed comes from a program block which can wait. Then access to the memory is performed prior to the instruction in the next program block. If the instruction in the next program block of the NC program cannot wait, the next program block is executed immediately following without first accessing the memory.
It is disadvantageous here that only a memory access to a slow memory is made, but no allocation of memory space. A further disadvantage is that a program block will only receive one instruction. Because of this it is necessary to add an identification to each single instruction whether or not the instruction can wait, and this identification must be checked during execution of the program. A further disadvantage lies in that a memory access, regardless of how important it is, possibly is not made and that a not inconsiderable delay can arise from this.